import request from '../utils/request';

export function sendEMail(username, mailbox, verificationCodeTag, verificationCode) {
    return request({
        url: '/web/user/register/sendEMail',
        method: 'get',
        params: { username, mailbox, verificationCodeTag, verificationCode }
    })
}

export function register(username, mailbox, password, mailboxcode) {
    const data = {
        username: username,
        mailbox: mailbox,
        password: password,
        mailboxcode: mailboxcode
    }
    return request({
        url: '/web/user/register',
        method: 'post',
        data: data
    })
}

export function login(mailbox, password, verificationCodeTag, verificationCode) {
    const data = {
        mailbox: mailbox,
        password: password,
        verificationCodeTag: verificationCodeTag,
        verificationCode: verificationCode
    }
    return request({
        url: '/web/user/login',
        method: 'post',
        data: data
    })
}



export function verifyToken() {
    const Token = localStorage.getItem('ms_token');
    return request({
        url: '/web/user/verifyToken',
        method: 'get',
        params: { Token }
    })
}